Learning Objectives

After completing this lesson, you’ll be able to:

Resources

Video

Introduction

As a technical analyst in the GIS department of a city, you are responsible for managing a workflow for mailing construction alerts to residents who might be affected by noise from City construction work. Normally you have to generate the list of affected residents yourself. However, you'd like to let the construction teams generate the list themselves, saving you valuable time.

So far, you have created a workspace that generates the list of affected residents and allows users to choose the format for their data download. Now you need to add a Geometry published parameter to let users interactively choose their area of interest.

1) Open Workspace

Open the starting workspace (C:\FMEData\Workspaces\CreateDataIntegrationApps\exercise-use-the-geometry-published-parameter.fmw) in FME Workbench (2023.0 or later).

2) Inspect Published Parameters

The starting workspace is in progress. It already has a published parameter that lets users choose the output format. You can find them by looking at the Navigator > User Parameters. Right-click FORMAT and choose Manage User Parameters to view its configuration:

Adding the FORMAT published parameter

This parameter lets the user choose the output format for the data they receive. The default is Microsoft Excel.

This parameter gives the user the option of four output formats (GeoJSON, OGC GeoPackage, Esri Shapefile, or Microsoft Excel). Using Choice with Alias like this lets you provide a set of formats or coordinate systems to the user instead of letting them pick from the entire list. This option can be beneficial as it is less overwhelming to the user and can prevent incorrect outcomes. Click Cancel to close the Parameter Manager.

3) Create a Geometry Published Parameter

Now let's edit this workspace so the user can define the area where construction will be occurring. The first step is to add a Geometry published parameter. In the Navigator, right-click User Parameters and choose Manage User Parameters:

Manage User Parameters

Create a new parameter (using the green plus icon in the top-right) with the following options:

Type Geometry
Parameter Identifier GEOM_COORDS
Prompt Select construction area:
Published Checked
Required Checked
Disable Attribute Assignment Checked
Conditional Visibility Unchecked

For Geometry Configuration, click on the ellipsis and enter the following:

Geometry Encoding GeoJSON
Geometry Types Polygon, Box, Line
Specify initial bounds for map display Checked
Top (-90..90) 49.2548
Left (-180..180) -123.244
Bottom (-90..90) 49.3034
Right (-180..180) -123.071

The initial bounds will be the area shown in FME Flow. Larger bounds will have the map zoomed out, and smaller bounds will have the map zoomed in. Your dialog should look like this:

Click OK to close the Parameter Manager.

4) Create the Area of Interest Polygon

Now that we have set up the geometry published parameter, we need to use it within the workflow. Add a GeometryReplacer in a new stream after the Creator transformer.

Adding a GeometryReplacer to create features from the Geometry published parameter

Open the parameters for the GeometryReplacer. Set the Geometry Encoding to GeoJSON and then set the Geometry Source to the GEOM_COORDS published parameter.

Setting the GeometryReplacer to use the Geometry published parameter

Click OK.

5) Reproject the Area of Interest

We want to ensure that FME knows our data is in LL84, as this is what the Geometry published parameter accepts as values. Add a CoordinateSystemSetter transformer after the GeometryReplacer. In the parameters, set the Coordinate System to LL84.

CoordinateSystemSetter parameters

Our source address data is in UTM83-10. It is more appropriate to buffer and intersect data in a projected coordinate system, so we will reproject both streams of data to UTM83-10. Add the first Reprojector after the CoordinateSystemSetter. Set the Destination Coordinate System to UTM83-10.

Reprojector parameters

Add a second Reprojector between the FeatureReader and the NotifyList writer feature type. We have to make a slight change to the address data coordinate system. Set the Destination Coordinate System to UTM83-10 and click OK.

Your workspace should look like this:

Current workspace state

6) Buffer the Area of Interest

We need to add a 100-meter buffer around the area of interest to find which neighboring residents might be affected by construction noise and must be notified. Add a Bufferer transformer connected to the first Reprojector. In the parameters, set the Buffer Distance to 100 and set the Buffer Distance Units to Meters.

Bufferer parameters

7) Clip the Addresses to the Area of Interest

Now we need to apply the buffered area of interest to our data. To do this we will use a Clipper transformer. Add a Clipper transformer to the canvas and connect the Bufferer's Buffered port to the Clipper input port. Then connect the Reprojector_2 to the Candidate input port. In the Clipper parameters, enable Merge Attributes.

Adding a Clipper

Click OK.

8) Clean up Attributes

One final step before we can write out our data is to clean up the attributes. Add an AttributeKeeper to the canvas and connect it to the Inside output port on the Clipper.

In the parameters, for Attributes to Keep, select:

Click OK.

9) Test Writing Results to Shapefile

Let's test our workspace by writing the results to a Shapefile. Connect the AttributeKeeper to the NotifyList writer feature type and run your workspace. Select Esri Shapefile as the output format.

For the Geometry parameter, we have to supply GeoJSON to test on FME Form. On FME Flow you can use a web map. Paste the following GeoJSON code in to test:

{"type":"Polygon","coordinates":[[[-123.131762,49.282752],[-123.132148,49.282465],[-123.131579,49.282087],[-123.131139,49.282332],[-123.131762,49.282752]]]}

When the translation finishes, click the NotifyList writer feature type once to select it and then click View Written Data. Specify Esri Shapefile for the Format and add NotifyList.shp to the end of the Dataset parameter:

Viewing the output shapefile

Click OK. The addresses to notify, those within 100m of the area of interest, should appear in the Visual Preview window.

Viewing the resulting addresses in Visual Preview

Note

We have provided GeoJSON code for testing the Geometry parameter. If you want to get your own GeoJSON to test, you can publish your unfinished workspace to FME Flow, fill out the Geometry parameter, and copy the resulting GeoJSON code. Alternatively, you can use an online service to generate the GeoJSON for you, e.g. https://geojson.io/. Just remember the parameter expects a single feature.

10) Publish to FME Flow

With the workspace complete, we can now publish to FME Flow. Click on the Publish button on the toolbar. Select the Training FME Flow connection and the Training repository. Select Data Download and Job Submitter as the Services.

11) Test on FME Flow

Click the Direct Link to the workspace in the Translation Log (http://localhost/fmeserver/#/workspaces/run/Training/exercise-use-the-geometry-published-parameter.fmw) and log in if necessary.

Select Training as the Repository and set the Service to Data Download.

For Published Parameters, you should see the Select construction area parameter. Click on the map icon to select the area.

Viewing the Geometry parameter on the FME Server Run Workspace page

When you click on the map icon, the Geometry parameter dialog will appear, which will have a map of the area set up in the published parameter, as well as options along the side to determine which geometry type you wish to use for your selection.

Select construction area geometry parameter

Zoom into the area of interest. For this example, we will zoom into downtown Vancouver and use the polygon tool to pick a small area of buildings.

Note

For this workspace to run correctly, buildings with addresses need to be selected. If an area is selected without an address the workspace won’t write out any data. To close off an area in a polygon, double-click on the starting point.

An area selected with the geometry parameter

Once the area is selected, click Confirm. GeoJSON coordinates will now be available in the Select construction area text box.

Once the map area has been selected, click Run to run the workspace.

When the workspace has finished running, click on the download link to get the data. Extract and open the data in Microsoft Excel or FME Data Inspector. This list can then be used to send letters to the residents affected by the construction.

Viewing the resulting addresses in Microsoft Excel